/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package it.unibo.as.client;

import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.ui.Composite;

/**
 *
 * @author Johnny
 */


public class GamePanel extends Composite{

    private final VerticalPanel verticalPanel;
    private final ChatPanel chatPanel;
    private CellTable<String> cellTable;

    public GamePanel() {

        verticalPanel = new VerticalPanel();

        TablePanel tablePanel = new TablePanel();

        verticalPanel.add(tablePanel);

        HorizontalPanel horizontalPanel = new HorizontalPanel();
        verticalPanel.add(horizontalPanel);
        horizontalPanel.setSize("1024px", "206px");

        chatPanel = new ChatPanel();
        horizontalPanel.add(chatPanel);


        cellTable = new CellTable<String>();
        horizontalPanel.add(cellTable);
        cellTable.setSize("223px", "189px");


        TextColumn<String> nameColumn = new TextColumn<String>(){
          @Override
          public String getValue(String contact) {
             return contact;
          }
        };
        TextColumn<String> addressColumn = new TextColumn<String>(){
        @Override
        public String getValue(String contact) {
           return contact;
           }
        };

        // Add the columns.
        cellTable.addColumn(nameColumn, "Player");
        cellTable.addColumn(addressColumn, "Points");


        initWidget(verticalPanel);
   }

   public void chatUpdate(String user,String line){
       chatPanel.chatAppend("\n" + user + ": " + line);
   }

   public void stateUpdate(){
       /* call TablePanel Update */
   }


}
